<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
	<th:block th:include="include :: header('新增货区设置')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-areaInfo-add">
			<div class="form-group">	
				<label class="col-sm-3 control-label">货区编码：</label>
				<div class="col-sm-8">
					<input id="areaCode" name="areaCode" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">货区名：</label>
				<div class="col-sm-8">
					<input id="areaName" name="areaName" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">仓库：</label>
				<div class="col-sm-8">
					<select id="wareId" name="wareId" class="form-control" >
						<option v-for="ware in wares" v-bind:value="ware.wareId">{{ware.wareName}}</option>
					</select>
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">备注：</label>
				<div class="col-sm-8">
					<input id="memo" name="memo" class="form-control" type="text">
				</div>
			</div>
		</form>
	</div>
    <div th:include="include::footer"></div>
    <script type="text/javascript">
		var prefix = ctx + "system/areaInfo";

		function submitHandler(){
			if ($.validate.form()) {
				$.operate.save(prefix + "/add", $('#form-areaInfo-add').serialize());
			}
		};

		var app = new Vue({
			el: '.wrapper',
			data: {
				message: 'Hello Vue!',
				wares:[],
			},
			methods:{


				getWares:function(){

					    var that = this;
						$.ajax({
							cache : true,
							type : "POST",
							url :  "/system/wareInfo/list",
							data : {

							},
							async : false,
							error : function(request) {
								$.modal.alertError("系统错误");
							},
							success : function(data) {
								that.wares = data.rows;
							}
						});

				}
			},
			created:function(){
				this.getWares();

				$("#form-areaInfo-add").validate({
					rules:{
						xxxx:{
							required:true,
						},
					},
					focusCleanup: true
				});
			},

		})
	</script>
</body>
</html>
